package com.pjh.shitang.configs;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.oas.annotations.EnableOpenApi;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

/**
 * @author yueyinghaibao
 * @date 2022/4/20
 */
@Configuration
public class SwaggerConfiguration {

    private ApiInfo info() {
        return new ApiInfoBuilder()
                .contact(new Contact("潘某某", "找你隔壁", "找你隔壁"))
                .title("食堂评论 - 在线API接口文档")
                .description("大概是不会维护了")
                .build();
    }

    @Bean
    public Docket docket() {
        return new Docket(DocumentationType.OAS_30)
                .apiInfo(info())
                .select()
                .apis(RequestHandlerSelectors.basePackage("com.pjh.shitang.controller"))
                .paths(PathSelectors.any())
                .build();
    }
}
